######################################
# Jlink Flash
######################################
JLINK_MCU      = STM32F103C8T6
JLINK_BIN_ADDR = 0x08000000
JLINK_SPEED    = 4000

all:
	touch .flash.txt
	echo usb 0 >> .flash.txt
	echo si 0 >>  .flash.txt
	echo jtagconf -1,-1 >> .flash.txt
	echo Device $(JLINK_MCU) >> .flash.txt
	echo speed $(JLINK_SPEED) >> .flash.txt
	echo r >> .flash.txt
	echo h >> .flash.txt
	echo loadfile $(BIN) $(JLINK_BIN_ADDR) >> .flash.txt
	echo Reset >> .flash.txt
	echo q >> .flash.txt
	tools/jlink/JlinkTool/JLink.exe  .flash.txt
	rm -rf .flash.txt